package D12_6z.普通字段的操作;

import java.lang.reflect.Field;

public class Demo1 {
    public static void main(String[] args) throws Exception {
        Class<?> aClass = Class.forName("Y2019.M12_.D12_6z.普通字段的操作.Student");
        Field name = aClass.getDeclaredField("name");
        Field age = aClass.getDeclaredField("age");
        name.setAccessible(true);
        age.setAccessible(true);
        Object o = aClass.newInstance();
        name.set(o,"小虎");
        age.set(o,25);
        System.out.println(name.get(o)+"\t"+age.get(o));
    }
}
